<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Notice;

class NoticeController extends Controller
{
    //
    public function index()
    {
        $notices = Notice::orderBy('created_at', 'desc')->paginate(2);
        return view('notice/notice',compact('notices'));
    }
    public function create()
    {
        return view('notice/create');
    }
    public function store()
    {
        $this->validate(request(), [
            'content' => 'required',
        ]);
        $content = request('content');
        $notice = Notice::create(compact('content'));
        return redirect('/notice');

    }
}
